<template>
	<view class="content">
		<image src="@/static/img/audit_img.png" class="liu" mode="widthFix"></image>
		<view class="notice">
			<image src="../../static/img/audit_msg.png" mode="widthFix"></image>
			<uni-notice-bar scrollable background-color="#FFF3EE" :speed="speed" color="#BC7A25" :text="text" />
		</view>
		<view class="info">
			<view class="title">买车贷款</view>
			<view class="item">
				<view>借款金额</view>
				<view class="item_c">￥{{money}}</view>
			</view>
			<!-- <view class="item">
				<view>年利化率</view>
				<view class="item_c">{{rate}}%</view>
			</view> -->
			<view class="item">
				<view>每期利息</view>
				<view class="item_c">{{interest}}元</view>
			</view>
			<view class="item">
				<view>借款期限</view>
				<view class="item_c">{{time}}</view>
			</view>
			<view class="item" v-if="week">
				<view>自定义周期(2-31天)</view>
				<view class="item_c">{{week}}天/周</view>
			</view>
		</view>
		<view class="default_btn mt_80" v-if="deal_status==0 && publish_wait==1" @click="edit()">修改借款信息</view>
		<view class="ples">请补充以下认证资料</view>

		<view class="info">
			<view class="item2" v-for="(item,i) in list1">
				<!-- <image :src="require(`@/static/img/${item.img}`)" mode="widthFix"></image> -->
				<image :src="item.icon" mode="widthFix"></image>
				<view class="text">
					<view>{{item.type_name}}</view>
					<view>{{item.file_tip}}</view>
				</view>
				<!-- <view v-if="item.is_upload==0" class="btn">立即上传</view>
				<view v-if="item.is_upload==1" class="btn">已上传</view> -->
				<view class="btn clo_1" v-if="item.is_upload==0" @click="to(item.url)">立即上传</view>
				<view class="btn clo_2" v-if="item.is_upload==1&&item.passed==0" @click="to(item.url)">等待审核</view>
				<view class="btn clo_3" v-if="item.is_upload==1&&item.passed==1" @click="to(item.url)">已上传</view>
				<view class="btn clo_4" v-if="item.is_upload==1&&item.passed==2" @click="to(item.url)">审核失败</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {applyState} from '@/common/js/index.js'
	export default {
		data() {
			return {
				title: 'Hello',
				topheight: uni.getStorageSync('topHeight'),
				totalheight: uni.getStorageSync('totalHeight'),
				navheight: uni.getStorageSync('navHeight'),
				imagelist: [
					require('@/static/img/home_bg3.png'),
					require('@/static/img/home_bg4.png')
				],
				barshow: false,
				speed: 50,
				text: '您的借款申请将于3个工作日内为您审核完成',
				hobby: [{
					text: '',
					value: 0
				}],
				checkbox1: '',
				list1: '',
				deal_id: '',
				money: '',
				rate: '',
				time: '',
				userId: '',
				interest:"",
				week: '',
				deal_status: '',
				publish_wait: '',
			}
		},
		onLoad(e) {
			console.log(e);
			this.deal_id = e.id
			this.userId = e.userId
			// this.deal_id = 202
			// this.select(e.id)
		},
		onShow() {
			this.select(this.deal_id)
		},
		methods: {
			edit() {
				uni.navigateTo({
					url:'/pages/index/apply?type=edit&id='+this.deal_id
				})
			},
			whit() {
				uni.showToast({
					title:'审核中…',
					icon:'none'
				})
			},
			isup() {
				uni.showToast({
					title:'已上传',
					icon:'none'
				})
			},
			select(id) {
				applyState({deal_id:id}).then(res=>{
					this.money = res.data.borrow_amount
					this.rate = res.data.rate
					this.time = res.data.repay_time
					this.interest = res.data.interest
					this.week = res.data.week
					this.deal_status = res.data.deal_status
					this.publish_wait = res.data.publish_wait
					var list = res.data.list
					for (var i = 0; i < list.length; i++) {
						var url 
						var info = JSON.stringify(list[i])
						// var info = this.userId
						if(list[i].id==1) url = '/pages/authentication/autonym?info='+info+'&id='+this.userId
						if(list[i].id==2) url = '/pages/authentication/work?info='+info+'&id='+this.userId
						if(list[i].id==3) url = '/pages/authentication/credit?info='+info+'&id='+this.userId
						if(list[i].id==4) url = '/pages/authentication/income?info='+info+'&id='+this.userId
						if(list[i].id==6) url = '/pages/authentication/house?info='+info+'&id='+this.userId
						if(list[i].id==11) url = '/pages/authentication/phone?info='+info+'&id='+this.userId
						if(list[i].id==16) url = '/pages/authentication/other?info='+info+'&id='+this.userId
						list[i].url = url
					}
					this.list1 = list
					console.log(res);
				})
			},
			to(e) {
				uni.navigateTo({
					url:e
				})
			},
			change(e) {
				console.log("e:", e);
			},
			apply() {
				uni.navigateTo({
					url: '/pages/index/apply'
				})
			}
		},
		onPageScroll(e) {
			if (e.scrollTop > 48) {
				this.barshow = true
			} else {
				this.barshow = false
			}
		},
	}
</script>

<style scoped lang="scss">
	.content {
		position: relative;
		overflow: hidden;
	}

	.liu {
		width: 694rpx;
		margin: 80rpx 28rpx 60rpx;
	}

	/deep/ .uni-noticebar {
		width: 690rpx;
		background-color: #FFF3EE;
		border-radius: 59rpx;
		padding-left: 80rpx;
	}

	.notice {
		margin: 0 30rpx;
		position: relative;

		image {
			position: absolute;
			left: 20rpx;
			top: 12rpx;
			width: 48rpx;
		}
	}

	.info {
		margin: 40rpx 30rpx;
		padding: 0 30rpx 40rpx;
		background-color: white;
		background: #FFFFFF;
		border-radius: 12rpx;
		overflow: hidden;

		.item {
			height: 100rpx;
			display: flex;
			align-items: center;
			font-size: 28rpx;
			border-bottom: 2rpx solid #EEEEEE;

			.item_c {
				font-weight: 500;
				flex: 1;
				text-align: right;
			}
		}

		.item2 {
			height: 142rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 2rpx solid #EEEEEE;
			
			image {
				width: 48rpx;
			}
			.text {
				flex: 1;
				margin-left: 16rpx;
				view{
					&:nth-of-type(1) {
						font-size: 28rpx;
					}
					&:nth-of-type(2) {
						font-size: 24rpx;
						color: #999999;
						margin-top: 6rpx;
					}
				}
			}

			.btn {
				width: 136rpx;
				height: 52rpx;
				line-height: 52rpx;
				text-align: center;
				border-radius: 30rpx;
				font-size: 26rpx;
			}
		}

		.title {
			margin: 30rpx 0 0 0;
			font-weight: 700;
			font-size: 32rpx;
		}
	}

	.ples {
		font-weight: 700;
		font-size: 32rpx;
		text-align: center;
		margin: 60rpx 0 0;
	}
	.clo_1 {
		border: 2rpx solid #FF534E;
		color: #FF534E;
	}
	.clo_2 {
		border: 2rpx solid #509DFC;
		color: #509DFC;
	}
	.clo_3 {
		border: 2rpx solid #56D087;
		color: #56D087;
	}
	.clo_4 {
		border: 2rpx solid #FF9903;
		color: #FF9903;
	}
	.mt_80 {
		margin-top: 80rpx;
	}
</style>